<?php

    // 4/26/2010: immanuel192 write this action to get bible ajax search

    if (!defined('EXPONENT')) exit('');

    global $db;
    $book_sf=40; $chapter_sf=1; $verse_sf=1;
    $book_st=66; $chapter_st=22; $verse_st=60;
    
    $translation=0; $search="";
    
    if (isset($_REQUEST['search']))
        $search=_ab_safe_html_string($_REQUEST['search']);
    
    if (isset($_REQUEST['book']))
        $book_sf=intval($_REQUEST['book']);
    if (isset($_REQUEST['chapter']))
        $chapter_sf=intval($_REQUEST['chapter']);
    
    $page=1;
    if (isset($_REQUEST['page']))
        $page=intval($_REQUEST['page']);
    
    // title
    $title = "Tìm kiếm '{$search}' trong Kinh Thánh";
    if ($page > 1)
    {
        $title.=" - Trang {$page}";
    }
    _ab_theme_action_register_title($title);
    
    $template=new template("biblemodule","_search",$loc);
    $template->assign("book_sf", $book_sf);
    $template->assign("book_st", $book_st);
    $template->assign("chapter_sf", $chapter_sf);
    $template->assign("chapter_st", $chapter_st);
    $template->assign("verse_sf", $verse_sf);
    $template->assign("verse_st", $verse_st);
    $template->assign("translation", $translation);
    $template->assign("page", $page);
    $template->assign("search", $search);
    $template->output();
    
    /* transfer params to $_REQUEST
    $_REQUEST['book_sf']=$book_sf;
    $_REQUEST['book_st']=$book_st;
    $_REQUEST['chapter_sf']=$chapter_sf;
    $_REQUEST['chapter_st']=$chapter_st;
    $_REQUEST['verse_sf']=$verse_sf;
    $_REQUEST['verse_st']=$verse_st;
    $_REQUEST['translation']=$translation;
    
    $_REQUEST['search']=$search;
    include ("bible_search.php")
    */
    
?>
